package com.atguigu.lease.web.admin.custom.config;

import com.atguigu.lease.web.admin.custom.converter.StringToBaseEnumConverterFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.format.FormatterRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * ClassName: WebMvcConfiguration
 * Descripition: SpringMVC专门用于自定义配置的接口（自定义的类型转换器需要在这里进行注册）
 *
 * @Create: 2024/12/10 - 下午 10:10
 */
@Configuration
public class WebMvcConfiguration implements WebMvcConfigurer {


    @Autowired
    private StringToBaseEnumConverterFactory converterFactory;

    //注册自定义的类型转换器
    @Override
    public void addFormatters(FormatterRegistry registry) {

        registry.addConverterFactory(converterFactory);
    }
}
